<?php

/* @var $this yii\web\View */
/* @var $model frontend\models\SignupForm */
/* @var $roles \yii\rbac\Role[] */

use common\widgets\MyForm;
use yii\helpers\Html;

$this->title = 'Signup';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?= Html::encode($this->title) ?></h1>

<p>Please fill out the following fields to signup:</p>

<?php $form = MyForm::begin([
    'id' => 'sign-form',
    'options' => ['class' => 'form-horizontal']
]); ?>

<div class="form-group field-signupform-username">
    <label class="control-label col-sm-2">User Name</label>
    <div class="col-sm-10">
        <?= $form->field($model, 'username') ?>
        <p class="hint-block">Please enter your name</p>
    </div>
</div>

<div class="form-group field-signupform-email">
    <label class="control-label col-sm-2">Email</label>
    <div class="col-sm-10">
        <?= $form->field($model, 'email') ?>
    </div>
</div>

<div class="form-group field-signupform-password">
    <label class="control-label col-sm-2">Password</label>
    <div class="col-sm-10">
        <?= $form->field($model, 'password')->passwordInput() ?>
    </div>
</div>

<div class="form-group field-signupform-first_name">
    <label class="control-label col-sm-2">First Name</label>
    <div class="col-sm-10">
        <?= $form->field($model, 'first_name') ?>
    </div>
</div>

<div class="form-group field-signupform-last_name">
    <label class="control-label col-sm-2">Last Name</label>
    <div class="col-sm-10">
        <?= $form->field($model, 'last_name') ?>
    </div>
</div>

<div class="form-group">
    <label class="control-label col-sm-2">Roles</label>
    <div class="col-sm-10">
        <?php foreach ($roles as $item): ?>
            <label class="checkbox-inline">
                <input type="checkbox" name="SignupForm[roles][]" value="<?= $item->name ?>"> <?= $item->name ?>
            </label>
        <?php endforeach ?>
    </div>
</div>

<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-primary">Signup</button>
    </div>
</div>

<?php MyForm::end(); ?>
